package org.springsource.controllers;

import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.social.twitter.api.CursoredList;
import org.springframework.social.twitter.api.Twitter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/social")
public class SocialController {
	
	private static final Logger logger = LoggerFactory.getLogger(SocialController.class);
	
	private final Twitter twitter;
	
	@Inject
	public SocialController(Twitter twitter) {
		this.twitter = twitter;
	}
	
	@RequestMapping(method = RequestMethod.GET)
	public String list() {
		CursoredList<Long> list = twitter.friendOperations().getFriendIds();
		if(list != null){
			logger.info("not null");
		}
		else{
			logger.info("null");
		}
		return "list.twitter";
	}
}
